<template>
  <div class="">
    <keep-alive>
      <router-view
        @messageReaded="messageReaded"
        @login-loading="loginLoading = $event"
      />
    </keep-alive>
    <navigation
      :class="{ 'loading-waiting': loginLoading }"
      v-show="!isShowNavigation"
      :navigation-menu="navigationMenu"
      :is-router="true"
      :defaultActiveKey="'0'"
    />
  </div>
</template>

<script type="text/ecmascript-6">
/*eslint-disable*/
import {initNavTitle,appName} from '@/utils/utils.ts'
import ddGoBackFilter from "@/views/home/homemixin";

export default {
  data() {
    return {
      navigationMenu:[
        {
          label: '首页',
          id: 0,
          routerPath: '/',
          activeImgHref: 'home-active.png',
          defaultImgHref: 'home@2x.png',
          badge: false,
        },
        {
          label: '消息',
          id: 1,
          routerPath: '/message',
          activeImgHref: 'xiaoxi-active.png',
          defaultImgHref: 'xiaoxi@2x.png',
          badge: false,
        },
      ],
      isShowNavigation:false,
      loginLoading:false
    }
  },
  mixins:[ddGoBackFilter],
  methods: {
    messageReaded(value){
      this.navigationMenu[1].badge = value;
    },
    changeNavigation(flag){
      this.isShowNavigation = flag
    }
  },
  created() {
    sessionStorage.clear()
    initNavTitle(appName)
    this.$bus.$on('isShowNavigation',this.changeNavigation)
  },

};
</script>
<style lang="less" scoped>
.loading-waiting {
  pointer-events: none;
  background-color: #f5f5f5;
}
</style>
